
package com.shop.cloud.mall.api.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shop.cloud.mall.common.entity.SeckillHallInfo;
import com.shop.cloud.mall.common.entity.SeckillInfo;
import com.shop.cloud.mall.api.mapper.SeckillInfoMapper;
import com.shop.cloud.mall.api.service.SeckillInfoService;
import org.springframework.boot.autoconfigure.klock.annotation.Klock;
import org.springframework.boot.autoconfigure.klock.model.LockTimeoutStrategy;
import org.springframework.stereotype.Service;
import java.io.Serializable;

/**
 * 秒杀商品
 *
 * @author
 * @date 2020-08-12 16:16:45
 */
@Service
public class SeckillInfoServiceImpl extends ServiceImpl<SeckillInfoMapper, SeckillInfo> implements SeckillInfoService {

	@Override
	@Klock(name = "SeckillInfo", keys = {"#entity.getId()"}, lockTimeoutStrategy = LockTimeoutStrategy.FAIL_FAST)
	public boolean updateById(SeckillInfo entity) {
		return super.updateById(entity);
	}

	@Override
	@Klock(name = "SeckillInfo", keys = {"#updateWrapper.getEntity().getId()"}, lockTimeoutStrategy = LockTimeoutStrategy.FAIL_FAST)
	public boolean update(Wrapper<SeckillInfo> updateWrapper) {
		return super.update(updateWrapper);
	}

	@Override
	@Klock(name = "SeckillInfo", keys = {"#id"}, lockTimeoutStrategy = LockTimeoutStrategy.FAIL_FAST)
	public boolean removeById(Serializable id) {
		return super.removeById(id);
	}

	@Override
	public IPage<SeckillInfo> page2(IPage<SeckillInfo> page, SeckillInfo seckillInfo, SeckillHallInfo seckillHallInfo) {
		return baseMapper.selectPage2(page, seckillInfo, seckillHallInfo);
	}

	@Override
	public SeckillInfo getById2(String id) {
		return baseMapper.selectById2(id);
	}
}
